{extend name="public/base"}
{block name='main'}
<!--编辑菜单-->
<form class="layui-form layui-form-pane" action="" style="padding:20px;">
  <input type="hidden" name="pid" />
  <input type="hidden" name="id" value="{$info.id|default=''}" />
  <div class="layui-form-item">
    <label class="layui-form-label">上级分类</label>
    <div class="layui-input-block">
      <select name="pid">
        <option value="0">顶级分类</option>
        {volist name="catelist" id="val" }
          <option value="{$val.id|default=''}" {eq name="$info.pid|default=''" value="$val.id"}selected="selected"{/eq} >{$val.name|default=''}</option>
        {volist name="val['erji']" id="vo"}
            <option value="{$vo.id|default=''}" {eq name="$info.pid|default=''" value="$vo.id"}selected="selected"{/eq}>&nbsp;&nbsp;&nbsp;├─ {$vo.name|default=''}</option>
        {/volist}
        {/volist}
      </select>
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">分类名称</label>
    <div class="layui-input-block">
      <input type="text" name="name" id="name" lay-verify="name" value="{$info.name|default=''}" placeholder="请输入" class="layui-input" >
    </div>
  </div>

  <div class="layui-form-item">
    <label class="layui-form-label">排序</label>
    <div class="layui-input-block">
      <input type="number" name="ordid" id="ordid" lay-verify="ordid" placeholder="请输入" class="layui-input" value="{$info.ordid|default='0'}">
    </div>
  </div>

  <div class="layui-form-item"  pane="">
    <label class="layui-form-label">是否启用</label>
    <div class="layui-input-block">
      <input type="radio" title="是" name="status" value="1" {eq name="info.status|default='1'" value="1"}checked="checked"{/eq}>
      <input type="radio" title="否" name="status" value="0" {eq name="info.status|default=''" value="0"}checked="checked"{/eq}>
    </div>
  </div>
  <div class="layui-form-item">
    <label class=""></label>
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit="" lay-filter="content_edit">提交保存</button>
    </div>
  </div>
</form>

<script type="text/javascript" src="__PUBLIC__/admin/layui/layui.js"></script>
<script>
  layui.use(['layer','jquery','form','element'], function () {
    // 操作对象
    var layer = layui.layer,$ = layui.jquery,form = layui.form, element = layui.element;
    //验证表单
    form.verify({
      name: function(value, item){ //value：表单的值、item：表单的DOM对象
        if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
          return '不能有特殊字符';
        }
        if(/(^\_)|(\__)|(\_+$)/.test(value)){
          return '首尾不能出现下划线\'_\'';
        }
        if(/^\d+\d+\d$/.test(value)){
          return '不能全为数字';
        }
      }

    });
    // 提交
    Oper.initUpdate(layui, '文档分类', 'content_edit', 'doc_cate/edit');
  });
</script>

{/block}